<?php

declare (strict_types=1);
namespace App\Model;

use Hyperf\Database\Model\SoftDeletes;

/**
 * @property int $id
 * @property string $name
 * @property \Carbon\Carbon $created_at
 * @property \Carbon\Carbon $updated_at
 * @property string $deleted_at
 * @property int $create_by
 * @property int $update_by
 * @property int $delete_by
 * @property int $province_id
 * @property int $city_id
 * @property int $area_id
 * @property int $street_id
 * @property string $tips
 */
class Landmark extends CloudBase
{
    use SoftDeletes;
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'fly_landmark';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' =>  'string', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'create_by' => 'string', 'update_by' => 'string', 'delete_by' => 'string',  'province_id' => 'integer', 'city_id' => 'integer', 'area_id' => 'integer', 'street_id' => 'integer'];

    public function link_industry()
    {
        $fields = ['fly_link_industry.*','fi.industry_name'];
        return $this->hasMany(LinkIndustry::class,'link_id','id')
            ->leftJoin('fly_industry as fi','fi.id','=','fly_link_industry.industry_id')
            ->where('fly_link_industry.type',2)
            ->select($fields);
    }
}